package com.dkm.ec.sale.repository.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.dkm.base.core.helper.SpringHelper;
import com.dkm.base.db.persistence.dao.IQueryDao;
import com.dkm.biz.repository.AbstractRepository;
import com.dkm.ec.sale.domain.SaleCollect;
import com.dkm.ec.sale.persistence.dao.SaleCollectQueryDao;
import com.dkm.ec.sale.persistence.entity.SaleCollectPo;
import com.dkm.ec.sale.repository.SaleCollectRepository;

/**
 * 对象功能:t_sale_collect Repository接口的实现类
 * 开发公司:dkm.com
 * 开发人员:ZHH
 * 创建时间:2017-05-23 09:42:05
 */
@Repository
public class SaleCollectRepositoryImpl extends AbstractRepository<String, SaleCollectPo,SaleCollect> implements SaleCollectRepository{
	  
	@Resource
	private  SaleCollectQueryDao saleCollectQueryDao;

	public SaleCollect newInstance() {
		SaleCollectPo po = new SaleCollectPo();
		SaleCollect saleCollect = SpringHelper.getBean(SaleCollect.class);
		saleCollect.setData(po);
		return saleCollect;
	}

	public SaleCollect newInstance(SaleCollectPo po) {
		SaleCollect saleCollect = SpringHelper.getBean(SaleCollect.class);
		saleCollect.setData(po);
		return saleCollect;
	} 
	
	@Override
	protected IQueryDao<String, SaleCollectPo> getQueryDao() {
		return saleCollectQueryDao;
	}

	@Override
	public List<SaleCollectPo> findSaleCollectByPartyId(String id) {
	    Map<String, Object> params = new HashMap<String, Object>();
	    params.put("partyId",  id);
		return saleCollectQueryDao.findByKey("findSaleCollectByPartyId", params);
	}
	
}
